import type { AddAreaParamsType, AreaDataType, RuleDropListType } from "@/types/carArea"
import { myGet, myPost, myRequest } from "@/utils/reuqest"

// 获取区域列表
export const getAreaDataAPI = (params: { page: number, pageSize: number }) => {
    return myGet<AreaDataType>('/parking/area/list', params)
}

// 获取计费规则下拉列表
export const getRuleDropListAPI = () => {
    return myGet<RuleDropListType[]>('/parking/rule/dropList')
}

// 添加区域请求
export const addAreaAPI = (data: AddAreaParamsType) => {
    return myPost('/parking/area', data)
}

// 编辑区域请求
export const editAreaAPI = (data: AddAreaParamsType & { id: number }) => {
    return myRequest({
        url: '/parking/area',
        method: 'PUT',
        data
    })
}

// 删除区域请求
export const deleteAreaAPI = (id: string) => {
    return myRequest({
        url: `/parking/area/${id}`,
        method: 'DELETE'
    })
}